#include "drv_temperature.h"
void drv_temperature_init(void)
{
	drv_iic_init();
	drv_iic_start();
	drv_iic_senddata(0x80);
	drv_iic_waitACK();
	drv_iic_senddata(0xe3);
	drv_iic_waitACK();
	drv_systick_ms(20);
	drv_iic_stop();
}
uint16_t drv_temperature(void)
{
	uint16_t data=0;
	drv_iic_start();
	drv_iic_senddata(0x81);
	if(drv_iic_waitACK()!= ACK)
	{
		drv_iic_stop();
	}
	drv_iic_stop();
	drv_iic_start();
	drv_iic_senddata(0x81);
	drv_iic_waitACK();
	data=drv_iic_readdata(ACK);
	data=data<<8;
	data=drv_iic_readdata(NACK);
	data=data>>2;
	drv_iic_stop();
	return -46.85+175.72*(double)data/65536;
}
